home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / deletefile.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  79 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: deletefile.c,v 1.1 1996/09/11 12:54:45 digulla Exp $
  4.     $Log: deletefile.c,v $
  5.     Revision 1.1  1996/09/11 12:54:45  digulla
  6.     A couple of new DOS functions from M. Fleischer
  7.  
  8.     Desc:
  9.     Lang: english
  10. */
  11. #include <exec/memory.h>
  12. #include <clib/exec_protos.h>
  13. #include <utility/tagitem.h>
  14. #include <dos/dos.h>
  15. #include <dos/filesystem.h>
  16. #include <clib/dos_protos.h>
  17. #include <clib/utility_protos.h>
  18. #include "dos_intern.h"
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.     #include <clib/dos_protos.h>
  24.  
  25.     __AROS_LH1(BOOL, DeleteFile,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(STRPTR, name, D1),
  29.  
  30. /*  LOCATION */
  31.     struct DosLibrary *, DOSBase, 12, Dos)
  32.  
  33. /*  FUNCTION
  34.     Tries to delete a file or directory by a given name.
  35.     May fail if the file is in use or protected from deletion.
  36.  
  37.     INPUTS
  38.     name       - NUL terminated name.
  39.  
  40.     RESULT
  41.     !=0 if the file is gone, 0 if is still there.
  42.     IoErr() gives additional information in that case.
  43.  
  44.     NOTES
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.  
  52.     INTERNALS
  53.  
  54.     HISTORY
  55.     29-10-95    digulla automatically created from
  56.                 dos_lib.fd and clib/dos_protos.h
  57.  
  58. *****************************************************************************/
  59. {
  60.     __AROS_FUNC_INIT
  61.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  62.  
  63.     /* Get pointer to process structure */
  64.     struct Process *me=(struct Process *)FindTask(NULL);
  65.  
  66.     /* Get pointer to I/O request. Use stackspace for now. */
  67.     struct IOFileSys io,*iofs=&io;
  68.  
  69.     /* Prepare I/O request. */
  70.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  71.     iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  72.     iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  73.     iofs->IOFS.io_Flags=0;
  74.     iofs->IOFS.io_Command=FSA_DELETE_OBJECT;
  75.     /* io_Args[0] is the name which is set by DoName(). */
  76.     return !DoName(iofs,name);
  77.     __AROS_FUNC_EXIT
  78. } /* DeleteFile */
  79.